package main

import (
	"fmt"
	"time"
)

type Employee struct {
	ID        int
	Name      string
	Address   string
	DoB       time.Time
	Position  string
	Salary    int
	ManagerID int
}

var dilbert Employee

func main() {
	dilbert.Salary -= 5000 // demoted, for writing too few lines of code

	position := &dilbert.Position
	*position = "Senior " + *position // promoted, for outsourcing to Elbonia

	//MARK 类型是可以省略的
	var employeeOfTheMonth *Employee = &dilbert
	//MARK 这2句一样
	(*employeeOfTheMonth).Position += " (proactive team player)"
	employeeOfTheMonth.Position += " (proactive team player)" //MARK 指针可以和变量一样直接. 语法糖

	id := dilbert.ID
	employeeByID := EmployeeByID(id)
	employeeByID.Salary = 99 // fired for... no real reason
	fmt.Println(employeeByID)

	fmt.Println(EmployeeByID(dilbert.ManagerID).Position)
}

func EmployeeByID(id int) Employee {
	/* ... */
	return Employee{Position: "Pointy-haired boss"}
}
